package com.example.controller.siyunCouponsController;

import com.example.pojo.siyunCouponsPojo.CouponsUsed;
import com.example.service.siyunCouponsService.CouponsUsedService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: 杨佳欣
 * @Description: TODO
 * @DateTime: 2022/11/8 9:10
 * 用户优惠券使用记录模块
 *    对用户使用优惠券进行记录以及功能操作
 *    并查看明细以及进行赠送操作
 **/

@RestController
@CrossOrigin
@RequestMapping("/couponsUsed")
public class CouponsUsedController {
    @Autowired
    private CouponsUsedService couponsUsedService;

    //用户优惠券使用记录表全查
    @RequestMapping("/getCouponsUsedAll")
    public List<CouponsUsed> getCouponsUsedAll(){
        return couponsUsedService.getCouponsUsedAll();
    }

    //用户优惠券使用记录表模糊查
    @RequestMapping("/getCouponsUsedFuzzyCheck")
    public List<CouponsUsed> getCouponsUsedFuzzyCheck(@RequestBody CouponsUsed couponsUsed){
        System.out.println(couponsUsed);
        return couponsUsedService.getCouponsUsedFuzzyCheck(couponsUsed);
    }

    //根据用户ID查询 用户优惠券使用记录表 单条数据
    @RequestMapping("/getCouponsUsedByUserId")
    public CouponsUsed getCouponsUsedByUserId(String userId){
        return couponsUsedService.getCouponsUsedByUserId(userId);
    }

    //联查三表数据展示
    /*@RequestMapping("/getCUOtableAll")
    public*/
}
